<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>Selectize.js Tests</title>
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
		<link rel="stylesheet" href="../examples/css/normalize.css">
		<link rel="stylesheet" href="vendor/mocha.css">
		<link rel="stylesheet" href="../dist/css/selectize.default.css">
		<style type="text/css">
		#fixture {
			background: #fafafa;
			padding: 30px;
			text-align: center;
			box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
		}
		</style>
		<!--[if IE 8]><script src="../examples/_es5.js"></script><![endif]-->
		<script src="../examples/js/jquery.js"></script>
		<script src="vendor/syn.js"></script>
		<script src="vendor/mocha.js"></script>
		<script src="vendor/chai.js"></script>
		<script src="/testem.js"></script>
		<script src="../dist/js/standalone/selectize.js"></script>
	</head>
    <body>
		<div id="mocha"></div>
		<form id="fixture"></form>
		<script>
    	mocha.setup({ui: 'bdd', ignoreLeaks: true});
		window.expect = chai.expect;
		window.assert = chai.assert;
		window.has_focus = function(elem) {
			return !!(elem === document.activeElement);
		};

		window.setup_test = function(html, options, callback) {
			if (window.test_last) window.test_last.teardown();

			var $select = $(html).appendTo('#fixture').selectize(options);
			var instance = $select[0].selectize;
			var test = window.test_last = {
				$select: $select,
				callback: callback,
				selectize: instance,
				teardown: function() {
					instance.destroy();
					$select.remove();
					window.test_last = null;
				}
			};

			return test;
		};

		after(function() {
			if (window.test_last) {
				window.test_last.teardown();
			}
		});

		$('#fixture').on('submit', function(e) { e.preventDefault(); });
    	</script>
		<!-- begin tests -->
		<script src="setup.js"></script>
		<script src="api.js"></script>
		<script src="events.js"></script>
		<script src="events_dom.js"></script>
		<script src="interaction.js"></script>
		<script src="xss.js"></script>
		<!-- end tests -->
		<script>
		if (window.mochaPhantomJS) { mochaPhantomJS.run(); }
		else { mocha.run(); }
		</script>
	</body>
</html>
